package com.ztgf.order.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.ztgf.order.models.bo.OrderAdminListBO;
import com.ztgf.order.models.bo.OrderInfoGoodsPageBO;
import com.ztgf.order.models.bo.OrderValetPlaceBO;
import com.ztgf.order.models.dto.OrderInfoDTO;
import com.ztgf.order.models.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * 订单表映射
 *
 * @author chenyu.wang
 * @Date 2020-06-03 15:32:26
 */
@Mapper
public interface OrderInfoMapper extends BaseMapper<OrderInfoDTO> {

    /**
     * 查出订单信息 带上 是否改价（只是适用于询价）
     *
     * @param id
     * @return
     */
    OrderInfoVO selectOrderInfoEnquiryVoById(Long id);


    /**
     * description: 查询订单详情
     * param: [orderId]
     * author: chenyu.wang
     * date: 2020-06-29
     * return: com.ztgf.order.models.vo.OrderDetailsVO
     */
    OrderDetailsVO getOrderDetailsById(@Param("orderId") Long orderId);

    /**
     * description: 查询询盘订单详情
     * param: [orderId]
     * author: chenyu.wang
     * date: 2020-06-29
     * return: com.ztgf.order.models.vo.OrderDetailsVO
     */
    OrderDetailsVO getPurchaseOrderDetailsById(@Param("orderId") Long orderId);

    /**
     * description: 订单列表
     * param: []
     * author: chenyu.wang
     * date: 2020-07-01
     * return: java.util.List<com.ztgf.order.models.vo.OrderInfoPageListVO>
     */
    List<OrderInfoPageListVO> queryListPage(Page<OrderInfoPageListVO> page, @Param("item") OrderInfoGoodsPageBO bo);

    /**
     * description: 询盘订单列表
     * param: []
     * author: chenyu.wang
     * date: 2020-07-01
     * return: java.util.List<com.ztgf.order.models.vo.OrderInfoPageListVO>
     */
    List<OrderInfoPageListVO> queryPurchaseListPage(Page<OrderInfoPageListVO> page, @Param("item") OrderInfoGoodsPageBO bo);

    /**
     * description: 查询订单商品信息
     * param: [orderId]
     * author: chenyu.wang
     * date: 2020-07-01
     * return: java.util.List<com.ztgf.order.models.vo.OrderInfoGoodsVO>
     */
    List<OrderInfoGoodsVO> queryOrderInfoGoods(Long orderId);

    /**
     * description: 查询订单付款信息
     * param: [orderId]
     * author: chenyu.wang
     * date: 2020-07-01
     * return: java.util.List<com.ztgf.order.models.vo.OrderInfoPayVO>
     */
    List<OrderInfoPayVO> queryOrderInfoPayMsg(Long orderId);

    /**
     * description: 根据订单id查询订单发票信息
     * param: [orderId]
     * author: chenyu.wang
     * date: 2020-07-02
     * return: com.ztgf.order.models.vo.OrderDetailsInvoiceVO
     */
    OrderDetailsInvoiceVO getOrderInvoiceByOrderId(@Param("orderId") Long orderId);

    List<OrderInfoSalesVO> querySalesList(@Param("shopId") Long shopId, @Param("startDate") String startDate, @Param("endDate") String endDate); //获取店铺的销售额

    /**
     * description: 查询订单发货信息详情
     * param: [orderId]
     * author: chenyu.wang
     * date: 2020-07-24
     * return: java.util.List<com.ztgf.order.models.vo.OrderShipDetailsVO>
     */
    List<OrderShipDetailsVO> queryOrderShipDetails(@Param(value = "orderId") Long orderId);

    /**
     * description: 后台管理系统订单列表
     * param: [page, bo]
     * author: chenyu.wang
     * date: 2020-07-30
     * return: java.util.List<com.ztgf.order.models.vo.OrderInfoPageListVO>
     */
    List<OrderInfoPageListVO> queryAdminListPage(Page<OrderInfoPageListVO> page, @Param("item") OrderAdminListBO bo);

    /**
     * description: 后台管理系统交易订单列表
     * param: [page, bo]
     * author: chenyu.wang
     * date: 2020-07-30
     * return: java.util.List<com.ztgf.order.models.vo.OrderInfoPageListVO>
     */
    List<OrderInfoPageListVO> queryDealOrderListPage(Page<OrderInfoPageListVO> page, @Param("item") OrderAdminListBO bo);


    /**
     * description: 后台管理系统线下交易订单列表
     * param: [page, bo]
     * author: chenyu.wang
     * date: 2020-07-30
     * return: java.util.List<com.ztgf.order.models.vo.OrderInfoPageListVO>
     */
    List<OrderInfoPageListVO> queryoffLineDealOrderListPage(Page<OrderInfoPageListVO> page, @Param("item") OrderAdminListBO bo);


    /**
     * description: 后台管理系统订单列表
     * param: [page, bo]
     * author: chenyu.wang
     * date: 2020-07-30
     * return: java.util.List<com.ztgf.order.models.vo.OrderInfoPageListVO>
     */
    List<OrderInfoPageListVO> queryPurchaseAdminListPage(Page<OrderInfoPageListVO> page, @Param("item") OrderAdminListBO bo);


    /*
     * @description:代客下单列表商品信息
     * @author: chenyu.wang
     * @date: 2020-08-10
     * @param:
     * @return:
     */
    List<OrderValetPlaceCommodityVO> queryValetCommodityList(@Param("orderId") Long orderId);

    /*
     * @description:后台管理系统代客下单列表
     * @author: chenyu.wang
     * @date: 2020-08-10
     * @param:
     * @return:
     */
    List<OrderValetPlaceVO> queryValetPlaceOrderList(Page<OrderValetPlaceVO> page, @Param("item") OrderValetPlaceBO bo);

    List<Long> getListBuyerIdBySellerShopId(Long sellerShopId);

    /**
     * @Description: 查询待签收的先款订单
     * @Author: chenyu.wang
     * @Param: []
     * @Date: 2020.10.22 17:40
     */
    List<OrderLogisticsVO> queryAdvanceOrderList(Page<OrderLogisticsVO> page, @Param(value = "lastNo") Long lastNo);

    /**
     * @return : java.util.List<com.ztgf.order.models.vo.ExportAdminOrderListQueryVO>
     * @Author :chenyu.wang
     * @Description : 后台管理系统订单导出查询
     * @Date : 2021.02.25 16:33
     * @Param : []
     **/
    List<ExportAdminOrderListQueryVO> queryExportAdminOrderList(@Param("shopId") Long shopId, @Param("id") Long id, @Param("status") Integer status);

    /**
     * @return : java.util.List<com.ztgf.order.models.vo.ExportAdminOrderListQueryVO>
     * @Author :chenyu.wang
     * @Description : 后台管理系统订单导出查询
     * @Date : 2021.02.25 16:33
     * @Param : []
     **/
    List<ExportAdminOrderListQueryVO> queryExportAdminOrderList(@Param("shopId") Long shopId, @Param("id") Long id, @Param("status") Integer status,@Param("purchaseOrderType") Integer purchaseOrderType);
    List<ExportAdminOrderListQueryVO> queryExportAdminOrderList1(@Param("item") OrderAdminListBO bo);
    /**
     * @return : java.util.List<com.ztgf.order.models.vo.ExportAdminOrderListQueryVO>
     * @Author :chenyu.wang
     * @Description : 后台管理系统订单导出查询
     * @Date : 2021.02.25 16:33
     * @Param : []
     **/
    List<ExportSellerOrderListQueryVO> queryExportSellerOrderList(@Param("shopId") Long shopId, @Param("id") Long id, @Param("status") Integer status,@Param("purchaseOrderType") Integer purchaseOrderType);


    /**
     * @return : com.ztgf.order.models.vo.OrderDetailsHeaderVO
     * @Author :chenyu.wang
     * @Description : 获取订单详情头部信息
     * @Date : 2021.03.10 14:47
     * @Param : [orderId]
     **/
    OrderDetailsHeaderVO queryOrderDetailsHeaders(@Param("orderId") Long orderId);

    OrderStatVo getStatusByOrderNum(@Param("orderNum")String orderNumber);

    BigDecimal getRefundPayMoney(@Param("orderId") Long orderId);


    List<ExportAdminOrderListQueryVO> queryExportAdminOrderListById(@Param("id") String id);

    List<OrderInfoShipVO> queryOrderShip(Page<OrderInfoShipVO> page,  @Param("item")OrderAdminListBO bo);

    //Page<OrderInfoShipVO> queryOrderShip(Page<OrderInfoShipVO> page, @Param("item") OrderAdminListBO bo);
}
